fix(gemini): support image conversion when content coerced to content… #9279
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
… blocks by setting output_version = v1
Fixes # (issue)
Right now when LC_OUTPUT_VERSION=v1 is set, content will be mapped to ContentBlock[] (https://docs.langchain.com/oss/javascript/migrate/langchain-v1#standard-content)
However, in the current
gemini.tsfile, content type is still deprecatedMessageContent, causingContentBlock.Multimodal.Imagecannot be converted toGeminiPartand throws unrecognized type error.This fix only take care of the
{type: "image", url: string}block because it's the only one I used in my project and I lack knowledge about all types. A thorough fix will require passing the standardized contentBlocks instead of content to those mapping functions.I have tested the fix in my project by directly changing the gemini.js file in dependency and it convert the block correctly for gemini to see the attached image.